﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="CuitException.cs" company="">
//   
// </copyright>
// <summary>
//   The cuit invalid search key.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace UITest.CUIT.CuitControls.Exceptions
{
    using System;
    using System.Collections.Generic;

    /// <summary>
    ///     The cuit invalid search key.
    /// </summary>
    public class CuitInvalidSearchKey : Exception
    {
        #region Constructors and Destructors

        /// <summary>
        /// Initializes a new instance of the <see cref="CuitInvalidSearchKey"/> class.
        /// </summary>
        /// <param name="key">
        /// The key.
        /// </param>
        /// <param name="searchProperties">
        /// The search properties.
        /// </param>
        /// <param name="controlProperties">
        /// The control properties.
        /// </param>
        public CuitInvalidSearchKey(string key, string searchProperties, List<string> controlProperties)
            : base(
                string.Format(
                    "Search Pattern Key not supported -> '{0}' in '{1}'. Available Properties: {2}", 
                    key, 
                    searchProperties, 
                    string.Join(", ", controlProperties)))
        {
        }

        #endregion
    }

    /// <summary>
    ///     The cuit invalid search parameter format.
    /// </summary>
    public class CuitInvalidSearchParameterFormat : Exception
    {
        #region Constructors and Destructors

        /// <summary>
        /// Initializes a new instance of the <see cref="CuitInvalidSearchParameterFormat"/> class.
        /// </summary>
        /// <param name="searchProperties">
        /// The search properties.
        /// </param>
        public CuitInvalidSearchParameterFormat(string searchProperties)
            : base(
                string.Format(
                    "Search Parameter Format is not valid -> '{0}', should be like 'sKey1=sValue1;sKey2=sValue2;'.", 
                    searchProperties))
        {
        }

        #endregion
    }

    /// <summary>
    ///     The cuit invalid filter parameter format.
    /// </summary>
    public class CuitInvalidFilterParameterFormat : Exception
    {
        #region Constructors and Destructors

        /// <summary>
        /// Initializes a new instance of the <see cref="CuitInvalidFilterParameterFormat"/> class.
        /// </summary>
        /// <param name="filterProperties">
        /// The filter properties.
        /// </param>
        public CuitInvalidFilterParameterFormat(string filterProperties)
            : base(
                string.Format(
                    "Filter Parameter Format is not valid -> '{0}', should be like 'sKey1=sValue1;sKey2=sValue2;'.", 
                    filterProperties))
        {
        }

        #endregion
    }

    /// <summary>
    ///     The cuit invalid filter key.
    /// </summary>
    public class CuitInvalidFilterKey : Exception
    {
        #region Constructors and Destructors

        /// <summary>
        /// Initializes a new instance of the <see cref="CuitInvalidFilterKey"/> class.
        /// </summary>
        /// <param name="key">
        /// The key.
        /// </param>
        /// <param name="filterProperties">
        /// The filter properties.
        /// </param>
        /// <param name="controlProperties">
        /// The control properties.
        /// </param>
        public CuitInvalidFilterKey(string key, string filterProperties, List<string> controlProperties)
            : base(
                string.Format(
                    "Filter Pattern Key not supported -> '{0}' in '{1}'. Available Properties: {2}", 
                    key, 
                    filterProperties, 
                    string.Join(", ", controlProperties)))
        {
        }

        #endregion
    }

    /// <summary>
    ///     The cuit invalid traversal.
    /// </summary>
    public class CuitInvalidTraversal : Exception
    {
        #region Constructors and Destructors

        /// <summary>
        /// Initializes a new instance of the <see cref="CuitInvalidTraversal"/> class.
        /// </summary>
        /// <param name="message">
        /// The message.
        /// </param>
        public CuitInvalidTraversal(string message)
            : base(
                string.Format(
                    "You are trying to traverse to an element/control which is not present in the tree: {0}", 
                    message))
        {
        }

        #endregion
    }

    /// <summary>
    ///     The cuit ui object not found.
    /// </summary>
    public class CuitUIObjectNotFound : Exception
    {
        #region Constructors and Destructors

        /// <summary>
        /// Initializes a new instance of the <see cref="CuitUIObjectNotFound"/> class.
        /// </summary>
        /// <param name="controlName">
        /// The control name.
        /// </param>
        /// <param name="searchProperties">
        /// The search properties.
        /// </param>
        public CuitUIObjectNotFound(string controlName, string searchProperties)
            : base(
                string.Format(
                    "You are trying to find to an element/control which is not present :  {0}{1} {0} with properties {2}", 
                    "<p>", 
                    controlName, 
                    searchProperties))
        {
        }

        #endregion
    }
}